package dao;

import java.util.List;
import java.util.Map;

import entity.Item;
import entity.Order;
import entity.ReceiveAddress;

@SuppressWarnings("unchecked")
public class OrderDao extends DangDao {
	protected String getNameSpace() {
		return Order.class.getSimpleName().toLowerCase();
	}

	public List<ReceiveAddress> getAddress(Integer user_id) throws Exception {
		return (List<ReceiveAddress>) queryForList("getAddress", user_id);
	}

	public ReceiveAddress getAddressById(Map<String, Object> paramMap) throws Exception {
		return (ReceiveAddress) queryForObject("getAddressById", paramMap);
	}

	public void saveReceiveAddress(ReceiveAddress ra) throws Exception {
		insert("saveReceiveAddress", ra);
	}
	
	public Integer saveOrder(Order order) throws Exception {
		return insert("saveOrder", order);
	}

	public void saveItem(Item item) throws Exception {
		insert("saveItem", item);
	}
}
